using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;

namespace PhoneNetwork.AntColony
{
    public class AntConstants
    {
        public int MaxAnts
        {
            get { return GetProperty("MaxAnts"); }
            set { SetProperty("MaxAnts", value); }
        }
        public int MaxCities
        {
            get { return GetProperty("MaxCities"); }
            set { SetProperty("MaxCities", value); }
        }
        public int Alpha
        {
            get { return GetProperty("Alpha"); }
            set { SetProperty("Alpha", value); }
        }
        public int Beta
        {
            get { return GetProperty("Beta"); }
            set { SetProperty("Beta", value); }
        }
        public int Rho
        {
            get { return GetProperty("Rho"); }
            set { SetProperty("Rho", value); }
        }
        public int VM
        {
            get { return GetProperty("VM"); }
            set { SetProperty("VM", value); }
        }
        public int PM
        {
            get { return GetProperty("PM"); }
            set { SetProperty("PM", value); }
        }
        private void SetProperty(string p, int value)
        {
            ConfigurationManager.AppSettings[p] = value.ToString();
        }

        private int GetProperty(string p)
        {
            int res;
            if (int.TryParse(ConfigurationManager.AppSettings[p], out res))
                return res;
            return -1;
        }
    }
}
